<template>
  <div class="DamageRegistrationItem">
    <div class="title">
      <p>破损登记时间：{{ data.createTime }}</p>
    </div>
    <div class="DamageRegistrationItemCon">
      <van-row>
        <van-col span="12">
          <div class="DamageRegistrationItemConItem">
            <h1>主&nbsp; 单&nbsp;号：</h1>
            <p>{{ data.masterWaybill }}</p>
          </div></van-col
        >
        <van-col span="12"
          ><div class="DamageRegistrationItemConItem">
            <h1>分&nbsp; 单&nbsp;号：</h1>
            <p>{{ data.subWaybill }}</p>
          </div></van-col
        >
        <van-col span="12">
          <div class="DamageRegistrationItemConItem">
            <h1>操&nbsp; 作&nbsp;人：</h1>
            <p>{{ data.createUserName }}</p>
          </div></van-col
        >
        <van-col span="12"
          ><div class="DamageRegistrationItemConItem">
            <h1>破损件数：</h1>
            <p>{{ data.damageNum }}</p>
          </div></van-col
        >
        <van-col span="24">
          <div class="DamageRegistrationItemConItem">
            <h1>破损图片：</h1>
            <p>
              <span @click="getDamageDetails(data.id)">查看</span> |
              <span
                v-if="
                  data.deliverGoodsStatus != 50 || data.deliverGoodsStatus != 60
                "
                @click="changeDamageDetailsEdit(data.id)"
                >编辑</span
              >
            </p>
          </div>
        </van-col>
        <van-col span="24">
          <div class="DamageRegistrationItemConItem">
            <h1>破损备注：</h1>
            <p>{{ data.remark }}</p>
          </div>
        </van-col>
      </van-row>
    </div>
  </div>
</template>

<script>
import Vue from "vue";
import { Col, Row } from "vant";

Vue.use(Col);
Vue.use(Row);
export default {
  props: ["data"],
  methods: {
    // 父组件获取详情
    getDamageDetails(e) {
      this.$emit("getDamageDetails", e);
    },
    // 父组件编辑
    changeDamageDetailsEdit(e) {
      this.$emit("changeDamageDetailsEdit", e);
    },
  },
};
</script>

<style lang="scss" scoped>
.DamageRegistrationItem {
  width: 100%;
  padding: 10px;
  box-sizing: border-box;
  background-color: #ffffff;
  border-radius: 10px;
  overflow: hidden;
  position: relative;
  margin-bottom: 10px;

  .title {
    width: 100%;
    padding-bottom: 10px;
    border-bottom: 2px dotted #b4b7c9;

    & > p {
      font-weight: 400;
      font-size: 12px;
      font-weight: 400;
      color: #8c9ba5;
      line-height: 20px;
      padding: 0 3px;
    }
  }

  .DamageRegistrationItemCon {
    width: 100%;
    padding-top: 15px;
    box-sizing: border-box;

    .DamageRegistrationItemConItem {
      width: 100%;
      display: flex;

      & > h1 {
        width: 85px;
        font-size: 16px;
        font-weight: 400;
        color: #999999;
        line-height: 30px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
      }

      & > p {
        flex: 1;
        font-size: 16px;
        font-weight: 400;
        color: #333;
        line-height: 30px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        span {
          color: #f29d12;
        }
      }
    }
  }
}
</style>
